<template>
	<view class="content paddinglr">
		<view class="toububjt margin_top" style="background-image: url('/static/image/shop/balanceHeader.png');">
			<view class="bigbtext text ">{{balanceInfo.shop_money}}</view>
			<view class="xbtext text margin_top">账户余额(元)</view>
			<!-- <view class="flexcenter margin_top">
				<view class="flexleft" >
					<image class="withdrawal margin_right1" src="/static/image/shop/withdrawal.png" mode=""></image>
					<view class="text_a" style="color: #fff;">
						提现
					</view>
				</view>
			</view> -->
			<view class="flexcenter sbianb margin_top">
				<view class="xbbtn flexcenter"  @click="goWithdrawal(balanceInfo.withdraw_price)">提现</view>
			</view>
		</view>
		<view class="margin_top">
			<view class="color_ling text_weight">余额明细</view>
			<view class="lan_img"></view>
		</view>

		<!-- <view class="flexcenter" style="margin-top: 200rpx;" v-if="!list.data.length">
			<view class="placeimage"></view>
		</view> -->
		<view class="">
			<!-- 余额明细 -->
			<view class="ffffff padding radius margin_top">
				<view class="xiahuax" v-for="(item,index) in list.data" :key="item.id">
					<view class="flexbetween">
						<view class="ershib1">{{item.memo}}{{item.is_frozen==0?'(冻结中)':''}}</view>
						<view class="qianshu">{{item.money}}</view>
					</view>
					<view class="margin_top qhtext">{{date(item.createtime)}}</view>
				</view>
			</view>
			<view class="flexcenter placeholderBoxTop" v-if="!list.data.length">
				<image class="placeholderBox" src="/static/placeholderimg.png" mode=""></image>
			</view>
			<!-- <view class="footertextdaodi">老板！到底没数据了！</view> -->
		</view>
	</view>
</template>
<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				balanceInfo: {},
				list: {
					data: []
				},
			}
		},
		// 跳转返还明细
		// onNavigationBarButtonTap(e) {
		// 	uni.navigateTo({
		// 		url: '/pages/mypage/fanhuanmx'
		// 	})
		// },
		onLoad(options) {

		},
		onShow() {
			this.init()
			this.yuelist()
		},
		methods: {
			init() { //余额信息
				httpRequest.request('/api/shop.index/shopbalance', 'GET', {}, false, false, true).then(res => {
					if (res.code == 1) {
						this.balanceInfo = res.data
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			yuelist(isPage, page) { //余额明细列表
				let _this = this;
				httpRequest.request('/api/shop.index/balance_log', 'GET', {
					page: page || 1,
				}).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							_this.list = res.data
							_this.list.data = resList.data;
						}
					}
				})
			},
			onReachBottom() { //页面触底加载，上拉加载
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.yuelist(true, page);
			},
			goWithdrawal(withdraw_price) {
				uni.navigateTo({
					url: "./withdrawal?withdraw_price=" + withdraw_price
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.withdrawal {
		width: 25.52rpx;
		height: 22.22rpx;
	}

	.lan_img {
		width: 127rpx;
		height: 10rpx;
		background-image: url('/static/image/shop/bl.png');
		background-size: 100% 100%;
		margin-top: -10rpx;
	}

	.xian {
		width: 22rpx;
		height: 0rpx;
		background-color: #999999;
		border: 1rpx solid #999999;
	}

	.shijianbtn {
		padding: 20rpx 65rpx;
		background: #F7F9FA;
		border-radius: 41rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
	}

	.huisebtn {
		width: 198rpx;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
		background: #F7F9FA;
		border-radius: 41rpx;
	}

	.haungsebtn {
		width: 198rpx;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #228DFF;
		background: rgba(250, 181, 54, .1);
		border-radius: 41rpx;
	}

	.sanshi {
		width: 33.33%;
	}

	.xiahuax {
		margin-top: 30rpx;
		padding-bottom: 30rpx;
		border-bottom: 2rpx solid rgba(0, 0, 0, 0.03);
	}

	.xiahuax:first-child {
		margin-top: 0rpx;
	}

	.xiahuax:last-child {
		padding-bottom: 0rpx;
		border-bottom: none;
	}

	.qhtext {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
	}

	.qianshu {
		font-size: 32rpx;
		font-family: DIN Next LT Pro-Bold, DIN Next LT Pro;
		font-weight: bold;
		color: #FD463E;
	}

	.ershib1 {
		font-size: 28rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #333333;
	}


	.zhtext {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
	}

	.banju {
		padding: 30rpx 30rpx 20rpx;
	}

	.line {
		width: 100%;
		border: 1rpx solid rgba(255, 255, 255, .1);
	}

	.xbtext {
		font-size: 36rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
	}

	.bigbtext {
		font-size: 80rpx;
		font-family: DIN Next LT Pro-Bold, DIN Next LT Pro;
		font-weight: bold;
		color: #FFFFFF;
	}

	.toububjt {
		// background-image: url('/static/image/shop/balanceHeader.png');
		background-size: 100% 100%;
		width: 100%;
		height: 404rpx;
		padding: 76rpx 0 20rpx;
	}
	.sbianb {
		padding-top: 25rpx;
		border-top: 1rpx solid rgba(255, 255, 255, .3);
	}
	
	.xbbtn {
		width: 194rpx;
		height: 65rpx;
		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		border: 2rpx solid #FFFFFF;
		color: #FFFFFF;
		border-radius: 10rpx;
	}
</style>